package com.jiuan.demo.model.http.request

import android.os.Build
import com.jiuan.demo.Flavors
import com.jiuan.retrofit.inter.IDynamicQueryClass
import java.util.*

class Header : IDynamicQueryClass {

    var Agent: String? = Build.MODEL
    var AgentID: String? = Build.HARDWARE
    var Hw: String? = Build.SERIAL
    var HwVer: String? = null
    var Fw: String? = Build.DISPLAY
    var FwVer: String? = Build.ID
    var Os: String? = "Android"
    var OsVer: String? = Build.VERSION.SDK_INT.toString()
    var App: String? = Flavors.get().appName
    var AppVer: String? = null
    var AppID: String? = null
    var Language: String? = java.util.Locale.getDefault().language
    var Locale: String? = java.util.Locale.getDefault().country
    var Account: String? = null
    var Token: String? = null
    var PackageName: String? = Flavors.get().packageName

    override fun toQuery(): Map<String, String?> {
        val map: HashMap<String, String?> = HashMap()
        val fields = Header::class.java.declaredFields;
        fields.map {
            map.put(it.name, it.get(this)?.toString());
        }
        return map;
    }
}
